package main

import (
	_ "demo/routers"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	_"github.com/go-sql-driver/mysql"
)

func init()  {
	mysqlurls := beego.AppConfig.String("mysqlurls")
	mysqluser := beego.AppConfig.String("mysqluser")
	mysqlpass := beego.AppConfig.String("mysqlpass")
	mysqldb := beego.AppConfig.String("mysqldb")

	orm.RegisterDriver("mysql", orm.DRMySQL)

	//连接数据库
	orm.RegisterDataBase("default","mysql",mysqluser+":"+mysqlpass+"@tcp("+mysqlurls+":3306)/"+mysqldb+"?charset=utf8",30)
}

func main() {
	o := orm.NewOrm()
	o.Using("default")
	beego.Run()
}

